AWS SQS

Parameters

This notification service is capable of sending simple messages to AWS SQS queue.

  • queue - name of the queue you are intending to send messages to. Can be overwriten with target destination annotation.
  • region - region of the sqs queue can be provided via env variable AWS_DEFAULT_REGION
  • key - optional, aws access key must be either referenced from a secret via variable or via env variable AWS_ACCESS_KEY_ID
  • secret - optional, aws access secret must be either referenced from a secret via variableor via env variable AWS_SECRET_ACCESS_KEY
  • account optional, external accountId of the queue
  • endpointUrl optional, useful for development with localstack

Example

Using Secret for credential retrieval:

Resource Annotation:

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx-deployment
  5. annotations:
  6. notifications.argoproj.io/subscribe.on-deployment-ready.awssqs: "overwrite-myqueue"
  • ConfigMap
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.awssqs: |
  7. region: "us-east-2"
  8. queue: "myqueue"
  9. account: "1234567"
  10. key: "$awsaccess_key"
  11. secret: "$awsaccess_secret"
  12. template.deployment-ready: |
  13. message: |
  14. Deployment {{.obj.metadata.name}} is ready!
  15. trigger.on-deployment-ready: |
  16. - when: any(obj.status.conditions, {.type == 'Available' && .status == 'True'})
  17. send: [deployment-ready]
  18. - oncePer: obj.metadata.annotations["generation"]

Secret

  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: <secret-name>
  5. stringData:
  6. awsaccess_key: test
  7. awsaccess_secret: test

Minimal configuration using AWS Env variables

Ensure following list of enviromental variable is injected via OIDC, or other method. And assuming SQS is local to the account. You may skip usage of secret for sensitive data and omit other parameters. (Setting parameters via ConfigMap takes precedent.)

Variables:

  1. export AWS_ACCESS_KEY_ID="test"
  2. export AWS_SECRET_ACCESS_KEY="test"
  3. export AWS_DEFAULT_REGION="us-east-1"

Resource Annotation:

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx-deployment
  5. annotations:
  6. notifications.argoproj.io/subscribe.on-deployment-ready.awssqs: ""
  • ConfigMap
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.awssqs: |
  7. queue: "myqueue"
  8. template.deployment-ready: |
  9. message: |
  10. Deployment {{.obj.metadata.name}} is ready!
  11. trigger.on-deployment-ready: |
  12. - when: any(obj.status.conditions, {.type == 'Available' && .status == 'True'})
  13. send: [deployment-ready]
  14. - oncePer: obj.metadata.annotations["generation"]